home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 10233 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.3 KB  |  46 lines

  1. Path: newsfeed.internetmci.com!panix!usenet
  2. From: gugu@panix.com (gugu)
  3. Newsgroups: comp.lang.c++
  4. Subject: re: gnu c/c++ compiler's fstream.h
  5. Date: 6 Mar 1996 20:46:15 GMT
  6. Organization: PANIX Public Access Internet and Unix, NYC
  7. Message-ID: <914.6639T952T978@panix.com>
  8. NNTP-Posting-Host: gugu.dialup.access.net
  9. X-Newsreader: THOR 2.22 (Amiga;TCP/IP) *UNREGISTERED*
  10.  
  11. I've tried to compile the following program to randomly access to read and
  12. write the file.
  13.  
  14. File letters.dat contains:
  15. ABCDEFGHOPQRSTUVWXYZ
  16.  
  17. --------------------------------------------------------------------------
  18. #include <fstream.h>
  19.  
  20. int main(void)
  21. {
  22.         fstream letters("letters.dat", ios::in | ios::out);
  23.         letters.seekp(8,ios::beg);
  24.  
  25.         for (char letter='I';letter<='Z';letters++)
  26.                 letters<<letter;
  27.         letters.seekg(0,ios::beg);
  28.  
  29.         while (!letters.eof())
  30.                 cout.put((char)letters.get());
  31.  
  32.         letters.close();
  33. }
  34. -----------------------------------------------------------------------------
  35.  
  36. 77 % g++ random.cc
  37. random.cc: In function `int main()':
  38. random.cc:8: no post-increment operator for type
  39. 78 %
  40.  
  41. I can't get it to work.  What does the error message mean?  I am new to C++
  42. and much help will be sooo much appreciated.  Thanks!
  43.  
  44. gugu@panix.com
  45.  
  46.